#include"processbar.h"
#include<unistd.h>
double total = 1024.0;
double speed = 2.0;
typedef void(*Bar)(double,double);

void upload(Bar bar)
{
    double current = 0;
    while(current <= total)
    {
        bar(current,total);
        usleep(3000);
        current += speed;
    }
    printf("\nupload %.2fMB done\n",total);
}

void Download(Bar bar)
{
    double current = 0;
    while(current <= total)
    {
        bar(current,total);
        usleep(3000);
        current += speed;
    }
    printf("\ndownload %.2fMB done\n",total);

}
int main()
{
   // process_v1();
   Download(FlushProcess);
   upload(FlushProcess);
    return 0;
}
